package cn.iocoder.yudao.module.crossborder.order.dal.mysql.orderreturnitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.orderreturnitem.OrderReturnItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.orderreturnitem.vo.*;

/**
 * 跨境电商退换货明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderReturnItemMapper extends BaseMapperX<OrderReturnItemDO> {

    default PageResult<OrderReturnItemDO> selectPage(OrderReturnItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderReturnItemDO>()
                .eqIfPresent(OrderReturnItemDO::getReturnId, reqVO.getReturnId())
                .eqIfPresent(OrderReturnItemDO::getReturnNo, reqVO.getReturnNo())
                .eqIfPresent(OrderReturnItemDO::getOrderItemId, reqVO.getOrderItemId())
                .eqIfPresent(OrderReturnItemDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(OrderReturnItemDO::getSkuCode, reqVO.getSkuCode())
                .likeIfPresent(OrderReturnItemDO::getProductName, reqVO.getProductName())
                .eqIfPresent(OrderReturnItemDO::getReturnQuantity, reqVO.getReturnQuantity())
                .eqIfPresent(OrderReturnItemDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(OrderReturnItemDO::getTotalAmount, reqVO.getTotalAmount())
                .eqIfPresent(OrderReturnItemDO::getRefundAmount, reqVO.getRefundAmount())
                .eqIfPresent(OrderReturnItemDO::getCurrencyCode, reqVO.getCurrencyCode())
                .eqIfPresent(OrderReturnItemDO::getReturnReason, reqVO.getReturnReason())
                .eqIfPresent(OrderReturnItemDO::getQualityIssue, reqVO.getQualityIssue())
                .eqIfPresent(OrderReturnItemDO::getReceivedQuantity, reqVO.getReceivedQuantity())
                .eqIfPresent(OrderReturnItemDO::getQualityCheckResult, reqVO.getQualityCheckResult())
                .eqIfPresent(OrderReturnItemDO::getRestockQuantity, reqVO.getRestockQuantity())
                .eqIfPresent(OrderReturnItemDO::getScrapQuantity, reqVO.getScrapQuantity())
                .eqIfPresent(OrderReturnItemDO::getBatchNo, reqVO.getBatchNo())
                .eqIfPresent(OrderReturnItemDO::getSerialNos, reqVO.getSerialNos())
                .eqIfPresent(OrderReturnItemDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderReturnItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderReturnItemDO::getId));
    }

}